<script setup>
import { homeGetBannerList } from '@/api/home';
import { ref, onMounted } from 'vue';
// 获取轮播图数据
const bannerList = ref([])
const getBnnerList = async () => {
  const res = await homeGetBannerList()
  bannerList.value = res.result
}
onMounted(() => {
  getBnnerList()
})
</script>



<template>
  <div class="home-banner">
    <el-carousel height="500px">
      <el-carousel-item v-for="item in bannerList" :key="item.id">
        <img
          src="http://yjy-xiaotuxian-dev.oss-cn-beijing.aliyuncs.com/picture/2021-04-15/6d202d8e-bb47-4f92-9523-f32ab65754f4.jpg"
          alt="">
      </el-carousel-item>
    </el-carousel>
  </div>
</template>



<style scoped lang='scss'>
.home-banner {
  width: 1240px;
  height: 500px;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 98;

  img {
    width: 100%;
    height: 500px;
  }
}
</style>
